﻿using Api.BLL;
using Api.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace Api.Web.helper
{
    public class BindDrop
    {
        public static List<SelectListItem> DropCategory(int id = 0)
        {
            List<Category> categoryList = CategoryBLL.Current.GetListNoTrack(s => s.UserId == Th.UserId && s.ProjectId == Th.ProjectId);
            categoryList.Insert(0, new Category
            {
                Name = "未选择类别",
                Id = -1,
            });
            return categoryList.Select(s => new SelectListItem
            {
                Text = s.Name,
                Value = s.Id.ToString(),
                Selected = id == s.Id
            }).ToList();
        }
    }
}